deriveTxnDateRangesForTaxDates

fun deriveTxnDateRangesForTaxDates(book: AccountBook, accounts: Set<Account>, taxDateRange: DateRange, onlyCostImpactingTxns: Boolean = true, txns: TxnSet? = null): Map<Account, DateRange>

Derive, per account, the transaction date range covering every txn whose tax date falls within taxDateRange. Use it to widen a calculation's universe so that tax date selection can see txns dated outside the requested range. Scans all of the relevant txns, so call it once, early, and only when needed.

Return

the minimum/maximum transaction dates found per account. An account with no qualifying txn is absent from the map.

Since

MD2027

Parameters

book

The account book.

accounts

The security account(s) to consider (pass security accounts, not investment accounts).

taxDateRange

The tax date range to match txns against.

onlyCostImpactingTxns

Default: true only considers txns that impact the cost basis. Use false to consider all txns found (e.g. BANK, DIVIDEND, DIVIDENDXFR)

txns

Default: null. Specify the set of transactions to operate on.